package com.wanmait.employment.manageController;

import com.wanmait.employment.entity.JobHoursBasice;
import com.wanmait.employment.service.JobHoursBasiceService;
import com.wanmait.employment.util.AjaxResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;


@RestController
@RequestMapping("/manage/JobHoursBasice")
@CrossOrigin
public class JobHoursBasiceController {
    @Resource
    private JobHoursBasiceService jobHoursBasiceService;

    @GetMapping("list")
    public AjaxResult List() {
        List<JobHoursBasice> jobHoursBasiceList = jobHoursBasiceService.selectList();
        return  AjaxResult.success("",jobHoursBasiceList);

    }

    @PostMapping("update")
    public AjaxResult update(@RequestBody JobHoursBasice jobHoursBasice) {
        if (jobHoursBasice.getId() != null) {
            jobHoursBasiceService.update(jobHoursBasice);
            return AjaxResult.success("修改成功");
        } else {
            jobHoursBasiceService.insert(jobHoursBasice);
            return AjaxResult.success("添加成功");
        }
    }

    @GetMapping("delete")
    public AjaxResult delete(Integer id) {
        jobHoursBasiceService.delete(id);
        return AjaxResult.success("删除成功");
    }
}
